﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;



namespace Linx.Update
{
    [ClassInterface(ClassInterfaceType.AutoDual)]

    [ProgId("linx.update.dll")]
    [ComVisible(true)]

    public class UpdateNF
    {
        public string strConexao { get; set; }
        public SqlConnection cn = new SqlConnection();
        //private string strServer;
        //private string strUserDB;
        //private string strPasswordDB;
        //private string strDatabase;
        //private string bWindowsAutentication;
        ConexaoDB conexaodb = new ConexaoDB();

        public void updateNfce(string connectionString, string nf_numero, string serie_nf, string codigo_filial)
        {
            string queryString = "update loja_nota_nfce set status_nfe = 5 where codigo_filial = "+ codigo_filial + 
                " and nf_numero = "+ nf_numero + " and serie_nf = " + serie_nf ;

            try
            {
                SqlCommand command = new SqlCommand(queryString, conexaodb.cn);
                command.CommandType = CommandType.Text;
                

                conexaodb.conectar(connectionString);

                command.ExecuteNonQuery();
                GravaLog.WriteErrorLog("Moreno");
                conexaodb.Desconectar();
            }
            catch (Exception)
            {
                cn.Close();
                //Library.WriteErrorLog(messageError);
                throw;
            }

        }

    }


}
